//index.js
//获取应用实例
const app = getApp()

Page({
  data: {
    isIpx:app.globalData.isIpx,
    law:0,
    hero:app.globalData.hero,
    miniopenid:null,
    phone:null,
    memberid:null,
    channel:app.globalData.channel,
    webviewIsShowed: false,
  },
  onLoad:function(options){
    console.log(app.globalData.hero);
    var that = this;
   
    that.setData({
      hero:app.globalData.hero,
    })

     var weappuserInfo = app.globalData.weappuserInfo;

     if(weappuserInfo.openId){
      console.log(weappuserInfo);

     }

     
 
    var law = options.law;

    // if(weappuserInfo.openId && weappuserInfo.member.id){
    if(weappuserInfo.openId ){
      that.setData({
        miniopenid:weappuserInfo.openId,
        memberid:'11111111',
      })
    }


    if(app.globalData.phone){
      that.setData({
        phone:app.globalData.phone,
      })
    }

    that.setData({
      law: law,
    })
  },onShareAppMessage: function (res) {
    var weappuserInfo = app.globalData.weappuserInfo;
    console.log(weappuserInfo);
    console.log(app.globalData.hero);
    if (res.from === 'button') {
      // 来自页面内转发按钮
      console.log(res.target)
    }
    return {
      title: '超级英雄跳一跳，清扬福利大放送！',
      path: 'pages/index/index?openid='+weappuserInfo.openId,
      imageUrl:'../images/'+app.globalData.hero+'.jpg',
    }
  },
})
